<template>
  <div>
    <BasicTable @register="registerTable">
     
    </BasicTable>
  </div>
</template>
<script lang="ts" setup name="bcs-list">
import {BasicTable, TableAction, ActionItem} from '@apps/antd-admin/src/components/Table';
import {useBaseTable} from '@apps/antd-admin/src/hooks';

import {Api} from '../../bcs/data/bcs.api';
import {columns, searchFormSchema} from '../../bcs/data/bcs.data';

const props = defineProps({
  brandId: {type: String, default: ""},
});
//初始化Table
const {prefixCls, tableContext} = useBaseTable({
  designScope: 'bcs-template',
  tableProps: {
    title: '车系列表',
    columns: columns,
    //主键字段
    rowKey: 'carSeriesId',
    //分页列表接口
    listUrl: Api.page,
    //删除接口
    delUrl: Api.remove,
    //是否显示索引列
    showIndexColumn: true,
    showTableSetting: false,
    //查询form配置
    formConfig: {
      baseColProps: {
        xxl: 10
      },
      schemas: searchFormSchema,
    },
    showActionColumn: false,
    beforeFetch: (params) => {
      params.brandId = props.brandId;
    },
    //操作列配置
    actionColumn: {
      width: 120,
    },
  },
});
const [registerTable, {reload, handleDelete, setProps, handleSuccess, handleBatchDelete}, {rowSelection, hasSelectedRows}] = tableContext;


/**
 * 下拉操作栏
 */
function getDropDownAction(record): ActionItem[] {
  return [
    {
      label: '删除',
      popConfirm: {
        title: '是否确认删除',
        icon: 'ant-design:delete-outlined',
        confirm: handleDelete.bind(null, record),
      },
    },
  ];
}


</script>
